package com.CST.controller.ys;

import com.CST.common.api.ResultObject;
import com.CST.dto.ys.HandleAppealDTO;
import com.CST.dto.ys.HandleDTO;
import com.CST.service.ys.YsAppealRecordService;
import com.CST.vo.ys.YsHandleVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/appealHandle")
@Api("申诉处理")
public class YsAppealHandlerController {
    private  final YsAppealRecordService service;
    public YsAppealHandlerController(YsAppealRecordService service) {
        this.service = service;
    }

    @ApiOperation("申诉记录")
    @PostMapping("/list")
    public ResultObject<List<YsHandleVO>> handleAppeal(@RequestBody HandleDTO dto){
        List<YsHandleVO> list = service.getAllRecord(dto);
        return ResultObject.success(list);
    }
    @ApiOperation("申诉处理")
    @PostMapping("/handle")
    public ResultObject<Integer> handleAppeal(@RequestBody HandleAppealDTO dto, HttpServletRequest request){
        return ResultObject.success(service.reject(dto,request));
    }





}
